USE eProjectSem3
GO
--CREATE VIEW SlectTypeJob--
CREATE VIEW SelectTypeJob
AS
SELECT * FROM tb_TypeJob
GO
--CREATE VIEW SelectUserApplicant--
CREATE VIEW SelectUserApplicant
AS
SELECT * FROM tb_Applicant


GO
--CREATE PROCEDURE UpdateStatusVacancy--
CREATE PROCEDURE UpdateStatusVacancy
@VacancyID		VARCHAR(10),
@Status			SMALLINT
AS
UPDATE tb_Vacancy SET [Status] = @Status WHERE VacancyID = @VacancyID

GO
--CREATE PROCEDURE UpdateStatusInterview--
CREATE PROCEDURE UpdateStatusInterview
@InterviewID	INT,
@Status			SMALLINT
AS
UPDATE tb_Interview SET [Status] = @Status WHERE InterviewID = @InterviewID

GO
--CREATE PROCEDURE ReturnInformationInterview--
CREATE PROCEDURE ReturnInformationInterview
@InterviewID	INT
AS
SELECT * FROM tb_Interview WHERE InterviewID = @InterviewID

GO
--CREATE PROCEDURE ReturnInterviewID--
CREATE PROCEDURE ReturnInterviewID
@InterviewID	INT
AS
SELECT tb_Interview.InterviewID FROM tb_Interview WHERE InterviewID = @InterviewID

GO
--CREATE VIEW SelectElementInterviewer--
CREATE VIEW SelectElementInterviewer
AS
SELECT * FROM tb_Interviewer

GO
--CREATE VIEW SelectElementApplicant--
CREATE VIEW SelectElementApplicant
AS
SELECT * FROM tb_Applicant

GO
--CREATE VIEW SelectElementVacancy--
CREATE VIEW SelectElementVacancy
AS
SELECT * FROM tb_Vacancy

--CREATE PROCEDURE UpdateTableInterview--
GO
CREATE PROCEDURE UpdateTableInterview
@InterviewID	INT,
@InterviewerID	NVARCHAR(10),
@VacancyID		NVARCHAR(10),
@ApplicantID	NVARCHAR(10),
@DateInterview	DATETIME,
@TimeDetails	NVARCHAR(10),
@Status			SMALLINT
AS
UPDATE tb_Interview SET InterviewerID = @InterviewerID, VacancyID = @VacancyID, ApplicantID = @ApplicantID, DateInterview = @DateInterview, TimeDetails = @TimeDetails, [Status] = @Status WHERE InterviewID = @InterviewID

--CREATE PROCEDURE SelectEmailApplicant--
GO
CREATE PROCEDURE ReturnEmail
@ApplicantID	VARCHAR(10)
AS 
SELECT EmailID from tb_Applicant WHERE ApplicantID = @ApplicantID